// custom-tab-bar/custom-tab-bar.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    translations: {},
    list: [{
        pagePath: "/pages/index/index",
        text: "首页",
        iconPath: "/public/image/icon_home2.png",
        selectedIconPath: "/public/image/icon_home1.png"
      },
      {
        pagePath: "/pages/apply/apply",
        text: "功能",
        iconPath: "/public/image/icon_app2.png",
        selectedIconPath: "/public/image/icon_app1.png"
      },
      {
        pagePath: "/pages/myInfo/myInfo",
        text: "我的",
        iconPath: "/public/image/icon_set2.png",
        selectedIconPath: "/public/image/icon_set1.png"
      }
    ]
  },

  onLoad: function () {
    // const app = getApp();
    // this.setData({
    //   translations: app.globalData.translations,
    // });
    // let list = this.data.list
    // list = list.map((v,i) => {
    //   if(i === 0) {
    //     v.text = this.translations.tab.home
    //   } else if(i === 1) {
    //     v.text = this.translations.tab.apply
    //   } else if(i === 2) {
    //     v.text = this.translations.tab.myInfo
    //   }
    // })
    // this.setData({list})
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      console.log(e);
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({
        url
      })
    },
  }
})